package com.group.orderproject.Dao;

import com.group.orderproject.pojo.Dish;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DishDao {
    @Select("select * from dish")
    /*查询所有,用来测试*/
    public List<Dish> findAll();
    @Select("select count(*) from dish where DishName like #{DishName}")
        /*查询总数*/
    Integer selectAllNum(String DishName);
    @Select("select * from dish where DishName like #{DishName}")
    /*模糊搜索*/
    List<Dish> selectByName(String DishName);
    @Select("select * from dish where DishName like #{DishName} limit #{pageNum},#{pageSize} ")
    /*分页查询*/
    List<Dish> selectPage(Integer pageNum,Integer pageSize,String DishName);
    @Insert("insert into dish(DishName,DishPrice,DishType,DishIcon,BusinessId) values (#{DishName}," +
            "#{DishPrice},#{DishType},#{DishIcon},#{BusinessId})")
    Integer insert(Dish dish);

    Integer update(Dish dish);
    @Delete("delete from dish where id=#{id}")
    Integer deleteById(@Param("id") Integer id);

    @Delete("delete from dish where id in (${ids})")
    Integer deleteByIds(@Param("ids")String ids);



}
